<?php
include_once '../Class/DB.php';
include_once 'common/top.php';
$db=new DB();
$name=$_POST["name"];
$password=$_POST["password"];
if(!$db->Is_exist($name))
{
?>
<script language="JavaScript">
alert("Name doesn't exist!");
window.location.href="index.php";
</script>
<?php
//header("Location:index.php");
exit();
}
$_SESSION['Passed']=$db->Verify($name, $password);
if($_SESSION['Passed'])
{
	$_SESSION['User']=$db->get_userName_info($name);
}
else 
{
?>
<script language="JavaScript">
alert("Wrong Password!");
window.location.href="index.php";
</script>
<?php 
}
?>
<script language="JavaScript">
window.location.href="index.php";
</script>
<?php 
//header("Location:index.php");
exit();
include_once 'common/tail.php';
?>